#!/bin/bash
BACKUP_DIR="/opt/games/backup"
DATE=$(date +%Y%m%d)
KEEP_DAYS=7

# 创建备份
tar -czf $BACKUP_DIR/games-$DATE.tar.gz \
    /opt/games/server \
    /opt/games/shared \
    /opt/games/*/client/build \
    /opt/games/ecosystem.config.js

# 删除旧备份
find $BACKUP_DIR -name "games-*.tar.gz" -mtime +$KEEP_DAYS -delete
